<?php
/**
 * @file
 * Returns the HTML for a single Drupal page.
 *
 * Complete documentation for this file is available online.
 * @see https://drupal.org/node/1728148
 */
global $theme_path;
$node = menu_get_object();
$fes = array();
if (!empty($node->field_article_content[LANGUAGE_NONE])) {
  foreach ($node->field_article_content[LANGUAGE_NONE] as $k => $v) {
    $fes[] = field_collection_item_load($v['value']);
  }
}
?>

<nav id="navigation" class="<?php print $classes; ?>">
    <div id="nav-backdrop" class="nav-backdrop"></div>
    <div id="nav-menu" class="nav-menu">
        <div class="wrapper">
            <?php echo bck_render_('jtv-mobile-menu-1'); ?>
            <div class="social-links">
                <a href="#" class="social-links-facebook"></a>
                <a href="#" class="social-links-instagram"></a>
            </div>
            <?php echo bck_render_('jtv-mobile-menu-2'); ?>
            <div class="social-links">
                <a href="#" class="social-links-facebook"></a>
                <a href="#" class="social-links-instagram"></a>
            </div>
            <?php echo bck_render_('jtv-mobile-menu-3'); ?>
        </div>
    </div>
</nav>

<div id="page">
    <header class="header" id="header" role="banner">
		<?php print render( $page['header']['metatags']); ?>
        <div class="wrapper">
            <div class="menu-trigger"></div>
            <a id="logo-jtv" href="/jtv"><img src="/<?php echo path_to_theme(); ?>/images/logo-jtv.svg" alt="JTV"></a>
            <!-- <a id="logo-jessicatv" href="/jessica-tv"><img src="/<?php echo path_to_theme(); ?>/images/logo-jessicatv.svg" alt="Jessica TV"></a> -->
            <div class="search-trigger"></div>
            <div class="font-size-trigger"></div>
                <?php echo bck_render('views', '-exp-search_page-page'); ?>
            <?php print render($page['header']); ?>
        </div>
    </header>

    <div id="main">
        <?php print $messages; ?>
        <?php echo bck_render_('jessica-channel-menu'); ?>
        <div class="block-dfp">
          <?php print bck_render_('ads-blog-1080x120'); ?>
        </div>
        <?php $b = drupal_get_breadcrumb();
        echo '<h2 class="element-invisible">You are here</h2><div class="breadcrumb">' . $b[0] .
(empty($b[1]) ? '' : '&nbsp;&nbsp;>&nbsp;&nbsp;' . $b[1]) .
(empty($b[2]) ? '' : '&nbsp;&nbsp;>>&nbsp;&nbsp;' . $b[2]) .
(empty($b[3]) ? '' : '&nbsp;&nbsp;>>&nbsp;&nbsp;' . $b[3]) .
(empty($b[4]) ? '' : '&nbsp;&nbsp;>>&nbsp;&nbsp;' . $b[4]) .
'</div>'; ?>
        <div id="content" class="column region-content" role="main">
            <article class="app" data-nid="<?php echo $node->nid; ?>" data-path="<?php echo url(drupal_get_path_alias('node/' . $node->nid)); ?>" data-title=<?php echo json_encode(urlencode($node->title)); ?>>
                <div class="wrapper">
                    <div class="article-inner">
                        <?php print render( $title_prefix ); ?>
                        <?php print render( $title_suffix ); ?>
                        <?php print render( $tabs ); ?>
                        <?php if ( $action_links ): ?>
                            <ul class="action-links"><?php print render( $action_links ); ?></ul>
                        <?php endif; ?>


                        <?php foreach ($fes as $fe): ?>
                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_image', array('label' => 'hidden', 'type' => 'img_with_caption'))); ?>

                            <div class="article-title">
                                <h2 class="node-title"><?php print $title; ?></h2>
                                <button class="article-share-toggle"></button>
                            </div>

                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_body', array('label' => 'hidden'))); ?>
                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_video', array('label' => 'hidden'))); ?>
                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_images', array('label' => 'hidden'))); ?>
                        <?php endforeach; ?>
                        <?php echo render_(field_view_field('node', $node, 'field_tags', array('label' => 'hidden'))); ?>

                        <div class="extend-read">
                            <h4>延伸閱讀 +</h4>
                            <?php echo render_(field_view_field('node', $node, 'field_jtv_links', array('label' => 'hidden'))); ?>
                        </div>

                        <div class="article-readmore">
                            <a href="#">+ 繼續閱讀</a>
                        </div>
<div class="block-dfp">
<?php print bck_render_('ads-article-300x250');?>
</div>

                    </div>
                </div>

            </article>
            <div id="article-loading"></div>
        </div>
    </div>

    <div class="region region-bottom"></div>
	<?php print render( $page['footer']['ga-dimension'] ); ?>
    <footer id="footer" class="region region-footer"></footer>

</div>
